<template>
  <div class="doctorTop">
    <doctorManagementTop @subFn2="searchFn" />
    <doctorManagementDown :searchList="list" @subFndel="doctordel" />
  </div>
</template>

<script>
import axios from "axios";
axios.defaults.baseURL = "http://localhost:8080/";
import doctorManagementTop from "../../components/Serve/doctorManagementTop.vue";
import doctorManagementDown from "../../components/Serve/doctorManagementDown.vue";
export default {
  components: {
    doctorManagementTop,
    doctorManagementDown,
  },
  data() {
    return {
      list: [],
    };
  },
  methods: {
    doctordel(id) {
      axios({
        url: "doctor/del",
        method: "GET",
        params: {
          id: id,
        },
      }).then((res) => {
        this.$notify({
          title: "成功",
          message: "删除成功",
          type: "success",
        });
        this.queryList();
      });
    },
    searchFn(value1, value2, value, name) {
      // alert(value2)
      axios({
        url: "doctor/getDoctorList",
        method: "GET",
        params: {
          doctor_organization: value1,
          doctor_team: value2,
          doctor_name: name,
        },
      }).then((res) => {
        this.list = res.data; //把值传到list里面
      });
    },
    queryList() {
      axios({
        url: "doctor/getDoctorList",
        method: "GET",
      }).then((res) => {
        console.log(res.data);
        this.list = res.data; //把值传到list里面
      });
    },
  },
  created() {
    document
      .querySelector("body")
      .setAttribute("style", "background-color:#F2F7FB");
    this.queryList();
  },
};
</script>

<style>
.doctorTop {
  width: 1150px;
  height: 1000px;
  background: white;
  margin: 20px auto;
  box-sizing: border-box;
  padding: 10px;
}
</style>